package com.zengqingfa.basic.enums;

/**
 * @fileName: EnumSwitchDemo
 * @author: zengqf3
 * @date: 2020-9-6 13:09
 * @description:
 */
public class EnumSwitchDemo {

    enum Signal {RED, YELLOW, GREEN}

    public static String getTrafficInstruct(Signal signal) {
        String instruct = "信号灯故障";
        switch (signal) {
            case RED:
                instruct = "红灯停";
                break;
            case YELLOW:
                instruct = "黄灯请注意";
                break;
            case GREEN:
                instruct = "绿灯行";
                break;
            default:
                break;
        }
        return instruct;
    }

    public static void main(String[] args) {
        String trafficInstruct = getTrafficInstruct(Signal.GREEN);
        System.out.println(trafficInstruct);//绿灯行
    }
}
